home *** CD-ROM | disk | FTP | other *** search
/ Animation How-To / Animation How-to CD.iso / PLY / COLORS.INC < prev    next >
Text File  |  1994-01-01  |  6KB  |  168 lines

  1. // define surface characteristics this file includes simple matte and
  2. // reflective surface characteristics for some common colors.
  3. // Polyray input file - Alexander Enzmann
  4.  
  5. // First define some standard surface characteristics, matte, shiny (plastic),
  6. // reflective.
  7. define matte
  8. surface {
  9.    ambient 0.1
  10.    diffuse 0.7
  11.    }
  12.  
  13. define shiny
  14. surface {
  15.    ambient 0.2
  16.    diffuse 0.6
  17.    specular white, 0.8
  18.    microfacet Cook 10
  19.    }
  20.  
  21. define reflective
  22. surface {
  23.    ambient 0.1
  24.    diffuse 0.7
  25.    specular white, 0.7
  26.    microfacet Phong 10
  27.    reflection white, 0.7
  28.    }
  29.  
  30. define metallic
  31. surface {
  32.    ambient 0.1
  33.    diffuse 0.7
  34.    specular 0.7
  35.    microfacet Phong 10
  36.    reflection white, 0.7
  37.    }
  38.  
  39. // Now build textures using different colors for the surfaces above
  40.  
  41. // First the matte colors.  Diffuse reflections only, no shiny spot
  42. define matte_white texture { matte { color white } }
  43. define matte_grey texture { matte { color grey } }
  44. define matte_black texture { matte { color dark_slate_gray } }
  45. define matte_red texture { matte { color red } }
  46. define matte_blue texture { matte { color blue } }
  47. define matte_green texture { matte { color green } }
  48. define matte_cyan texture { matte { color cyan } }
  49. define matte_yellow texture { matte { color yellow } }
  50. define matte_magenta texture { matte { color magenta } }
  51. define matte_orange texture { matte { color orange } }
  52. define matte_aquamarine texture { matte { color aquamarine } }
  53. define matte_brown texture { matte { color brown } }
  54.  
  55. // Now the standard plastic coloration, diffuse color plus shiny white spot
  56. define shiny_red texture { shiny { color red } }
  57. define shiny_green texture { shiny { color green } }
  58. define shiny_blue texture { shiny { color blue } }
  59. define shiny_cyan texture { shiny { color cyan } }
  60. define shiny_yellow texture { shiny { color yellow } }
  61. define shiny_magenta texture { shiny { color magenta } }
  62. define shiny_orange texture { shiny { color orange } }
  63. define shiny_coral texture { shiny { color coral } }
  64. //define steel_blue texture { shiny { color steel_blue } }
  65.  
  66. // A set of surfaces that combine color with reflectivity
  67. define reflective_white texture { reflective { color white } }
  68. define reflective_grey texture { reflective { color grey } }
  69. define reflective_red texture { reflective { color red } }
  70. define reflective_blue texture { reflective { color blue } }
  71. define reflective_green texture { reflective { color green } }
  72. define reflective_cyan texture { reflective { color cyan } }
  73. define reflective_yellow texture { reflective { color yellow } }
  74. define reflective_magenta texture { reflective { color magenta } }
  75. define reflective_orange texture { reflective { color orange } }
  76. define reflective_coral texture { reflective { color coral } }
  77. define reflective_brown texture { metallic { color brown } }
  78. define reflective_tan texture { metallic { color tan } }
  79. define reflective_gold texture { metallic { color coral } }
  80.  
  81. // And now some specific colors
  82. define glass
  83. texture {
  84.    surface {
  85.       ambient 0
  86.       diffuse 0
  87.       specular 0.2
  88.       reflection white, 0.1
  89.       transmission white, 1, 1.5
  90.       }
  91.    }
  92.  
  93. define mirror
  94. texture {
  95.    surface {
  96.       ambient white, 0.1
  97.       diffuse white, 0.2
  98.       specular 0
  99.       reflection white, 1
  100.       }
  101.    }
  102.  
  103. // Now we define some color map lookup functions that provide the ability
  104. // to mimic the predefined texture functions in other raytracers.  Most of
  105. // these would be modified in some way, perhaps to add more or less turbulence
  106. // to one of the variables, or perhaps to perform scaling in one or more
  107. // direction.  The look of a texture that uses one of these functions will
  108. // depend on how much it is scaled and what the color map looks like
  109.  
  110. define agate_fn ((sin(6.2832 * (1.1*z + 2.6 * noise(P, 4)))+1)/2)^0.77
  111. define marble_fn sawtooth(x + 2*noise(P, 4))
  112. define granite_fn noise(10*P, 4)
  113. define wood_fn sawtooth(sqrt(x*x+y*y))
  114. define noisy_wood_fn
  115.    sawtooth(|<x+sin(x+dnoise(P,3)[0]), y+sin(y+dnoise(P,3)[1]), 0>|)
  116. define bozo_fn noise(P, 1)
  117. define leopard_fn ((sin(x)+sin(y)+sin(z))/3)^2
  118. define onion_fn fmod(|P|, 1)
  119. define noisy_onion_fn fmod(|P|+noise(P, 3), 1)
  120. define checker_fn |fmod(floor(x)+floor(y)+floor(z), 2)|
  121. define three_color_checker_fn |fmod(floor(x)+floor(y)+floor(z), 3)|
  122.  
  123. // Some standard sorts of color maps to use with the functions above (or
  124. // modifications thereof).
  125. define white_marble_map
  126.    color_map([0, 0.8, white, 0.5*white]
  127.          [0.8, 1, 0.5*white, 0.2*white])
  128. define red_marble_map
  129.    color_map([0, 0.8, <1, 0.6, 0.6>, <1, 0.4, 0.4>]
  130.          [0.8, 1, <1, 0.4, 0.4>, <1, 0.1, 0.1>])
  131. define jade_color_map
  132.    color_map([0, 0.8, <1, 0.6, 0.1>, <0, 0.3, 0>]
  133.          [0.8, 1, <0.1, 0.5, 0.1>, <0, 0, 0.3>])
  134. define sky_color_map
  135.    color_map([0, 0.5, <0.2, 0.2, 0.5>, <0.2, 0.2, 0.5>]
  136.          [0.5, 0.6, <0.2, 0.2, 0.5>, 0.75*white]
  137.          [0.6, 1, 0.75*white, 0.25*white])
  138.  
  139.  
  140. define bright_pink texture { shiny { color pink } }
  141.  
  142. //-------- Declare Green Colors
  143. define g2 <0.27, 0.34, 0.26> //---Med Gray Green
  144. define g4 <0.03, 0.18, 0.08> //---Dark Green
  145.  
  146. define Jade
  147. texture {
  148.    noise surface {
  149.       color white
  150.       position_fn 1
  151.       lookup_fn 1
  152.       octaves 6
  153.       turbulence 5
  154.       ambient 0.2
  155.       diffuse 0.6
  156.       specular 0.3
  157.       microfacet Reitz 5
  158.       color_map(
  159.      [0.0, 0.1, White,     0.3, SeaGreen,  0.4]
  160.      [0.1, 0.3, SeaGreen,  0.4, g2,        0.7]
  161.      [0.3, 0.5, g2,        0.7, DarkGreen, 0.7]
  162.      [0.5, 0.7, DarkGreen, 0.7, g4,        0.7]
  163.      [0.7, 0.8, g4,        0.7, DarkGreen, 0.7]
  164.      [0.8, 1.0, DarkGreen, 0.7, DarkGreen, 0.7])
  165.    }
  166. }
  167.  
  168.